﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterSGA.Master" AutoEventWireup="True" CodeBehind="EditAssociates.aspx.cs" Inherits="SGA.Associate.EditAssociates" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ScriptManager" runat="server"></ajaxToolkit:ToolkitScriptManager>
    <script type="text/javascript" src="/Scripts/bootstrap.min.js"></script>

    <%-- Data sources--%>
    <%--<asp:EntityDataSource ID="EDSAssociates1" runat="server" ConnectionString="name=MailingEntities" DefaultContainerName="MailingEntities" EntitySetName="Associates" Include="Supporters" EnableInsert="True" EnableUpdate="True" AutoGenerateWhereClause="True" EntityTypeFilter="Associates"></asp:EntityDataSource>--%>
    <asp:EntityDataSource ID="EDSAssociates" runat="server" DefaultContainerName="MailingEntities" ConnectionString="name=MailingEntities" EntitySetName="Associates" EntityTypeFilter="Associates" Include="Supporters, SystemUsers" EnableUpdate="True" AutoGenerateWhereClause="True" EnableInsert="True">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EDSDonationSituations" runat="server" DefaultContainerName="MailingEntities" ConnectionString="name=MailingEntities" EnableFlattening="False" EntitySetName="DonationSituations">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EDSCollectingRanges" runat="server" DefaultContainerName="MailingEntities" ConnectionString="name=MailingEntities" EnableFlattening="False"
        EntitySetName="CollectingRanges" EntityTypeFilter="CollectingRanges"
        Where="it.IsActive=true" OrderBy="it.CollectingDay">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EDSBankColletingTypes" runat="server" ConnectionString="name=MailingEntities" DefaultContainerName="MailingEntities" EnableFlattening="False" EntitySetName="BankCollectingTypes">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EDSCollectingAmendments" runat="server" ConnectionString="name=MailingEntities" DefaultContainerName="MailingEntities" EnableFlattening="False" EntitySetName="CollectingAmendments" EntityTypeFilter="" OrderBy="" Select="">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EDSSuspensionContacTypes" runat="server" ConnectionString="name=MailingEntities" DefaultContainerName="MailingEntities" EnableFlattening="False" EntitySetName="SuspensionContactTypes" OrderBy="">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EDSReasonForSuspension" runat="server" DefaultContainerName="MailingEntities" ConnectionString="name=MailingEntities" EntitySetName="ReasonsForSuspensions" OrderBy="" AutoPage="False" AutoGenerateOrderByClause="True" EnableFlattening="False">
    </asp:EntityDataSource>
    <%--End Data sources--%>

    <div class="container-fluid">
        <div class="row">
            <div class="col-md-1 sidebar">
                <ul class="nav nav-sidebar">
                    <li class="active">
                        <%--<asp:Button ID="DisableEnterBtn" runat="server" Text="" OnClientClick="return false;" Visible="False" />--%>
                        <%--<asp:Button ID="SaveBtn" runat="server" Text="Gravar" CssClass="buttonContext" OnClick="SaveBtn_Click" />--%>
                        <asp:Button ID="SaveBtn" runat="server" Text="Gravar" CssClass="btn btn-default" Width="100" />
                    </li>
                    <li>
                        <%--<asp:Button ID="ReatamentoBtn" runat="server" Text="Exec. Reatamento" CssClass="buttonContext" OnClick="ReatamentoBtn_Click" />--%>
                        <asp:Button ID="ReatamentoBtn" runat="server" Text="Reatar" CssClass="btn btn-default" Width="100" />
                    </li>
                    <li>
                        <asp:Button ID="ReceiptsBtn" runat="server" Text="Recibos" CssClass="btn btn-default" Width="100" />
                    </li>
                    <li>
                        <%--<asp:Button ID="CheckIBANBtn" runat="server" Text="Verificar IBAN" CssClass="buttonContext" OnClientClick="return Confim();" OnClick="CheckIBANBtn_Click" />--%>
                        <asp:Button ID="CheckIBANBtn" runat="server" Text="Verificar IBAN" CssClass="btn btn-default" Width="100" />
                    </li>
                </ul>
            </div>

            <%-- DataSupporter --%>
            <div class="col-md-11 main">

                <ajaxToolkit:TabContainer ID="ChargeTabContainer" CssClass="MyCustomTab" runat="server" ActiveTabIndex="0" Height="600px" Width="1180px" ScrollBars="Auto">
                    <ajaxToolkit:TabPanel ID="ChargesTabPanel" runat="server" HeaderText="Cobrança">
                        <ContentTemplate>

                            <asp:FormView ID="FVAssociates" runat="server" DefaultMode="Edit">
                                <EditItemTemplate>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Num.</span>
                                                    <asp:TextBox ID="NumSupporterTbox" runat="server" class="form-control input-sm text-right" disabled placeholder="Número"
                                                        Text='<%#Eval("IdSupporters")%>'></asp:TextBox>
                                                </div>
                                            </div>
                                            <div class="col-md-4">
                                                <asp:TextBox ID="NameSupporterTbox" runat="server" class="form-control input-sm" disabled placeholder="Nome"
                                                    Text='<%#Eval("Supporters.Designation")%>'></asp:TextBox>
                                            </div>
                                            <div class="col-md-2">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Últ. modif.</span>
                                                    <asp:TextBox ID="LastModificationTbox" runat="server" class="form-control input-sm text-right" disabled
                                                        Text='<%# String.Format("{0:dd/MM/yyyy}",Eval("LastModification")) %>'></asp:TextBox>
                                                </div>
                                            </div>
                                            <div class="col-md-2">
                                                <asp:TextBox ID="UserTbox" runat="server" class="form-control input-sm" disabled placeholder="User"
                                                    Text='<%#Eval("SystemUsers.Alias") %>'>
                                                </asp:TextBox>
                                            </div>
                                        </div>
                                    </div>

                                    <%--dados bancários--%>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-md-7">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Nome de</span>
                                                    <asp:TextBox ID="NameOfTbox" runat="server" class="form-control"
                                                        Text='<%#Bind("NameOf")%>'>
                                                    </asp:TextBox>
                                                </div>
                                            </div>
                                            <div class="col-md-3">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Data obtenção</span>
                                                    <asp:TextBox ID="ObtainDateTbox" runat="server" class="form-control text-right" disabled
                                                        Text='<%#Bind("ObtainingDate")%>'>
                                                    </asp:TextBox>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="row">
                                            <%--coluna esquerda--%>
                                            <div class="col-md-3">
                                                <div class="input-group">
                                                    <span class="input-group-addon">País (IBAN)</span>
                                                    <asp:TextBox ID="CountryBankTbox" runat="server" class="form-control text-right" AutoPostBack="True"
                                                        Text='<%#Bind("CountryBank")%>'>
                                                    </asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="regexIBAN" runat="server" ErrorMessage="Dados inválidos!" ControlToValidate="CountryBankTbox" CssClass="Alert" Display="Dynamic" ForeColor="White" ValidationExpression="^[a-zA-Z]{2}[0-9]{2}$" BackColor="Red"></asp:RegularExpressionValidator>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Banco</span>
                                                    <%--<asp:TextBox ID="NumberBankTbox" runat="server" class="form-control" OnTextChanged="NumberBankTbox_TextChanged" AutoPostBack="True" />--%>
                                                    <asp:TextBox ID="NumberBankTbox" runat="server" class="form-control text-right"
                                                        Text='<%#Bind("NumberBank")%>' />
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Agência</span>
                                                    <%--<asp:TextBox ID="NumberAgencyTbox" runat="server" class="form-control" OnTextChanged="NumberAgencyTbox_TextChanged" AutoPostBack="True" />--%>
                                                    <asp:TextBox ID="NumberAgencyTbox" runat="server" class="form-control text-right"
                                                        Text='<%#Bind("NumberAgency")%>' />
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Nº conta</span>
                                                    <%--<asp:TextBox ID="NumberAccountTbox" runat="server" class="form-control" OnTextChanged="NumberAgencyTbox_TextChanged" AutoPostBack="True" />--%>
                                                    <asp:TextBox ID="NumberAccountTbox" runat="server" class="form-control text-right"
                                                        Text='<%#Bind("NumberAccount")%>' />
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Digito contolo</span>
                                                    <%--<asp:TextBox ID="CheckDigitAccountTbox" runat="server" class="form-control" OnTextChanged="NumberAgencyTbox_TextChanged" AutoPostBack="True" />--%>
                                                    <asp:TextBox ID="CheckDigitAccountTbox" runat="server" class="form-control text-right"
                                                        Text='<%#Bind("CheckDigitAccount")%>' />
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">SWIFT/BIC</span>
                                                    <asp:TextBox ID="BICTbox" runat="server" class="form-control text-right"
                                                        Text='<%#Bind("BIC")%>' />
                                                </div>

                                                <asp:Label ID="InvalidIbanNibLbl" runat="server" Text="IBAN/NIB inválido!" Font-Bold="False" ForeColor="White" Visible="False" BackColor="Red" />
                                            </div>

                                            <%--coluna centro--%>
                                            <div class="col-md-4">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Tipo contribuição</span>
                                                    <asp:DropDownList ID="DonationSituationDdl" CssClass="form-control" runat="server" AppendDataBoundItems="True"
                                                        DataSourceID="EDSDonationSituations" DataTextField="Designation" DataValueField="Id"
                                                        SelectedValue='<%#Bind("IdDonationSituations") %>'>
                                                        <asp:ListItem Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Valor contribuição</span>
                                                    <asp:TextBox ID="ValueDonationTbox" class="form-control text-right" runat="server"
                                                        Text='<%#Bind("ValueDonation")%>' />
                                                    <asp:RegularExpressionValidator ID="regexValueDonation" runat="server" ErrorMessage="Valor inválido!" ControlToValidate="ValueDonationTbox" CssClass="Alert" Display="Dynamic" ForeColor="White" ValidationExpression="^(\d+(((\.|\,)\d)?|((\.|\,)\d\d)?))$" BackColor="Red"></asp:RegularExpressionValidator>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Data cobrança</span>
                                                    <asp:DropDownList ID="CollectingDateDdl" class="form-control" runat="server" AppendDataBoundItems="True"
                                                        DataSourceID="EDSCollectingRanges" DataValueField="Id" DataTextField="CollectingDay"
                                                        SelectedValue='<%#Bind("IdCollectingRanges") %>'>
                                                        <asp:ListItem Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Valor máximo</span>
                                                    <asp:TextBox ID="MaxDonationTbox" class="form-control text-right" runat="server"
                                                        Text='<%#Bind("MaxDonation")%>' />
                                                    <asp:RegularExpressionValidator ID="regexMaxDonation" runat="server" ErrorMessage="Valor inválido!" ControlToValidate="MaxDonationTbox" CssClass="Alert" Display="Dynamic" ForeColor="White" ValidationExpression="^(\d+(((\.|\,)\d)?|((\.|\,)\d\d)?))$" BackColor="Red"></asp:RegularExpressionValidator>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Valor contribuição alternativo</span>
                                                    <asp:TextBox ID="AlternativeCollectingValueTbox" CssClass="form-control text-right" runat="server"
                                                        Text='<%#Bind("AlternativeCollectingValue")%>' />
                                                    <asp:RegularExpressionValidator ID="regexAlternativeValue" runat="server" ErrorMessage="Valor inválido!" ControlToValidate="AlternativeCollectingValueTbox" CssClass="Alert" Display="Dynamic" ForeColor="White" ValidationExpression="^(\d+(((\.|\,)\d)?|((\.|\,)\d\d)?))$" BackColor="Red"></asp:RegularExpressionValidator>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Data cobrança alternativa</span>
                                                    <asp:DropDownList ID="AlternativeCollectingDateDdl" CssClass="form-control" runat="server" AppendDataBoundItems="True"
                                                        DataSourceID="EDSCollectingRanges" DataValueField="Id" DataTextField="CollectingDay"
                                                        SelectedValue='<%#Bind("IdCollectingRangesAlternative") %>'>
                                                        <asp:ListItem Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                            </div>

                                            <%--coluna direita--%>
                                            <div class="col-md-4">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Status tipo cobrança</span>
                                                    <asp:DropDownList ID="BankCollectingTypesDdl" CssClass="form-control" runat="server"
                                                        DataSourceID="EDSBankColletingTypes" DataValueField="Id" DataTextField="Designation"
                                                        SelectedValue='<%#Bind("IdBankCollectingTypes") %>'>
                                                    </asp:DropDownList>
                                                    <%--<ajaxToolkit:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="SuspensionDateTbox" DaysModeTitleFormat="dd-MM-yyyy" Enabled="True" Format="dd-MM-yyyy" TodaysDateFormat="dd-MM-yyyy" CssClass="MyCalendar"></ajaxToolkit:CalendarExtender>--%>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Alterações cobrança</span>
                                                    <asp:DropDownList ID="ColletionAmendmentDdl" CssClass="form-control" runat="server"
                                                        DataSourceID="EDSCollectingAmendments" DataTextField="Designation" DataValueField="Id"
                                                        SelectedValue='<%#Bind("IdCollectingAmendments") %>'>
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Nº autorização actual</span>
                                                    <asp:TextBox ID="ActualAuthorizTbox" runat="server" CssClass="form-control text-right" disabled
                                                        Text='abc' />
                                                    <%--Text='<%# SequenceNumber(Eval("ResumingSequence").ToString()) %>' />--%>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Sequência da autorização</span>
                                                    <%--<asp:TextBox ID="SequenceTbox" runat="server" Columns="5" OnTextChanged="SequenceTbox_TextChanged" />--%>
                                                    <asp:TextBox ID="SequenceTbox" class="form-control text-right" runat="server"
                                                        Text='<%#Bind("ResumingSequence")%>' />
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="SequenceTbox" CssClass="Alert" Display="Dynamic" ErrorMessage="Valor inválido!" ValidationExpression="^([0-9]+)$" BackColor="Red" ForeColor="White"></asp:RegularExpressionValidator>
                                                </div>
                                                <asp:CheckBox ID="WantReceiptCbox" runat="server" Text='Enviar recibo mensal'
                                                    Checked='<%# Bind("WantReceipt")%>' />
                                            </div>
                                        </div>
                                    </div>

                                    <%--cancelamento--%>
                                    <div class="form-group">
                                        <div class="row">
                                            <%--div esquerda--%>
                                            <div class="col-md-3">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Data suspensão</span>
                                                    <asp:TextBox ID="SuspensionDateTbox" class="form-control text-right" runat="server" />
                                                    <%--<ajaxToolkit:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="SuspensionDateTbox" DaysModeTitleFormat="dd-MM-yyyy" Enabled="True" Format="dd-MM-yyyy" TodaysDateFormat="dd-MM-yyyy" CssClass="MyCalendar"></ajaxToolkit:CalendarExtender>--%>
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Motivo</span>
                                                    <asp:DropDownList ID="ReasonSuspDdl" CssClass="form-control" runat="server" AppendDataBoundItems="True"
                                                        DataSourceID="EDSReasonForSuspension"
                                                        DataTextField="Designation" DataValueField="Id">
                                                        <asp:ListItem Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                            </div>

                                            <%--div esquerda--%>
                                            <div class="col-md-4">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Forma de contacto</span>
                                                    <asp:DropDownList ID="SuspensionContatTypeDdl" class="form-control" runat="server" AppendDataBoundItems="True"
                                                        DataSourceID="EDSSuspensionContacTypes"
                                                        DataTextField="Designation" DataValueField="Id">
                                                        <asp:ListItem Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                            </div>

                                            <%--div direita--%>
                                            <div class="col-md-3">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Data reatamento</span>
                                                    <asp:TextBox ID="ResumingDateTbox" runat="server" class="form-control text-right" disabled />
                                                </div>
                                                <div class="input-group">
                                                    <span class="input-group-addon">Nº autorização nova</span>
                                                    <asp:TextBox ID="ResumingNewSequenceTbox" runat="server" class="form-control text-right" disabled />
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <%--Observações--%>
                                    <div class="form-group">
                                        <div class="row">
                                            <%--<h4 class="sub-header">Dados da cobrança</h4>--%>
                                            <div class="col-md-10">
                                                <div class="input-group">
                                                    <span class="input-group-addon">Observações</span>
                                                    <asp:TextBox ID="ObservationsTbox" runat="server" class="form-control" TextMode="multiline" Rows="5"
                                                        Text='<%#Bind("Observations")%>' />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </EditItemTemplate>
                            </asp:FormView>

                        </ContentTemplate>
                    </ajaxToolkit:TabPanel>
                    <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="teste">
                        <ContentTemplate>

                        </ContentTemplate>
                    </ajaxToolkit:TabPanel>
                </ajaxToolkit:TabContainer>


            </div>
        </div>
    </div>
</asp:Content>
